package player;


import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;

import java.io.*;

public class MyPlayer {
    File file;
    static File fileList[]=new File[100];
    public MyPlayer(String filepath){
        file=new File(filepath);
    }
    public MyPlayer(String songList[]){
        for(int i=0;i<songList.length;i++){
            fileList[i]=new File(songList[i]);
        }
    }
    public void play()  {

        try{
        FileInputStream fis=new FileInputStream(file);
        BufferedInputStream stream=new BufferedInputStream(fis);
        Player player=new Player(stream);
        player.play();
        }catch(FileNotFoundException e1){}
        catch(JavaLayerException e2){}

    }
    public void playList(){
        for(int i=0;i<fileList.length;i++){
            try{
                FileInputStream fis=new FileInputStream(fileList[i]);
                BufferedInputStream stream=new BufferedInputStream(fis);
                Player player=new Player(stream);
                player.play();
            }catch(FileNotFoundException e1){}
            catch(JavaLayerException e2){}
        }
    }
}
